<h1>Contactos</h1>

<% form_tag contacts_path, :method => 'get' do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search" , :name => nil %>
</p>
<% end %>

<table>
  <tr>
    <th>Title</th>
    <th>Name</th>
    <th>City</th>
    <th>State</th>
    <th>Country</th>
    <th>Date updated</th>
  </tr>

<% if @contacts %>
<% for contact in @contacts %>
	<tr>
	   <td><%=h contact.title %></td> 
        <td><%= link_to contact.name, contact_path(contact) %><td>
	<td><%=h contact.city %></td>
    	<td><%=h contact.state %></td>
    	<td><%=h contact.country %></td>
    	<td><%=h contact.date_updated %></td>
        </tr>
<% end %>
<% end %>

</table>

<% if @contacts %>
<%= will_paginate @contacts %>
<% end %>

<br />


<%= link_to 'New contact', new_contact_path %>
